package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpReportsSMSMASCountsComparedToSPPageUtil extends SeleniumPageUtil {
	public final static By RSMCCT_LINK_VIEW_REPORT = By.id("ctl44_btnSearch");
	public final static By RSMCCT_SPAN_HEADER = By.id("ctl44_lblHdr");
	public final static By RSMCCT_SPAN_SELECT_CUSTOMER = By.id("ctl44_lblPrompt");
	public final static By RSMCCT_INPUT_SELECT_CUSTOMER = By.id("ctl44_txtCustomer");
	public final static By RSMCCT_TD_BETWEEN = By.xpath("//*[@id='ctl44_trDates']/td[1]");
	public final static By RSMCCT_INPUT_START = By.id("ctl44_txtStart");
	public final static By RSMCCT_TD_AND = By.xpath("//*[@id='ctl44_trDates']/td[2]");
	public final static By RSMCCT_IMG_START = By.id("ctl44_imgStart");
	public final static By RSMCCT_INPUT_END = By.id("ctl44_txtStop");
	public final static By RSMCCT_IMG_END = By.id("ctl44_imgStop");
	
	public static void enterReportsSMSMASCountsComparedToSPPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterReportsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpReportsDefaultPageUtil.RD_LINK_SITE_AUDITS_MAS_COUNTS_COMPARED_TO_SP));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_REPORTS_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				RSMCCT_LINK_VIEW_REPORT, RSMCCT_IMG_START, RSMCCT_IMG_END 
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSMCCT_LINK_VIEW_REPORT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSMCCT_IMG_START));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSMCCT_IMG_END));
	}
}
